<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var year =  prompt('请输入你的出生年份')
        // console.log(date)
        var age = 2024 - date //这里用的减法 有隐式转换
        // console.log(age)
        alert('你的年龄为'+age)
</script>
</head>
<body>
    
</body>
</html>